to use the normal
The code is as follows
Copy Code
Package code{Optimization of pixel-level exact collision algorithmCode: AoneImport Flash.display.BitmapData;Import Flash.display.BlendMode;Import Flash.display.DisplayObject;Import Flash.geom.ColorTransform;Import Flash.geom.Matrix;Import Flash.geom.Point;Import Flash.geom.Rectangle;public class HitTest{public static var tilesize:int = 20;public static function Complexhittestobject (Target1:displayobject, target2:dis
transform-origin. For example: transform: translateX (100px ):
3. translateY (
): Specify a translation by specifying the number of Y directions. Only move to the Y axis. The base point is at the element base point. You can change the base point position through transform-origin. For example, transform: translateY (20px ):
Iii. scale
Scaling scale is very similar to moving translate, and it also has three situations: scale (x, y) enables horizontal and vertical scaling of elements (t
exactly the same thing]
Here is my addition to imagecopyresized
It implements bicubic interpolation of pixels so the result is much better
Than the ordinary imagecopyresized...
Copy it into the src/ext/gd/gc. c and recompile the lib.
I wish someone cocould do that so it's stored in the "official"
Release
It's a really good function to scale down pictures to thumbnails.
/* {Proto int imagecopyresizedbicubic (int dst_im, int src_im, int
Dst_x, int dst_y, int src_x, int src_y, int dst_w, int
is the offset? It's time to use the translate value of the matrix. So we can know the image in the coordinate system offset, along with how you can move the coordinates are accurate alignment.
Copy Code code as follows:
Private HashMap getimageviewineersize (ImageView IV) {
HashMap size=new HashMap ();
Get the transformation matrix of image in ImageView
Matrix m = Iv.getimagematrix ();
Float[] values = new FLOAT[10];
M.getvalues (values);
The transformation matr
; 0 _ designResolutionSize. height> 0)
{
// Use screen resolution and design resolution to obtain the x-axis and Y-axis scaling factors.
_ ScaleX = (float) _ screenSize. width/_ designResolutionSize. width;
_ ScaleY = (float) _ screenSize. height/_ designResolutionSize. height;
// In NO_BORDER mode, the maximum scaling factor is used. Obviously, this type of situation causes the small (narrow) side to exceed the actual size, which may ca
(); view.invalidate ();
}
);
(3) Look at the above example, because the set of the operation of the property only one, then if I want an animation to be able to make the view can be reduced, and can fade out (3 attributes Scalex,scaley,alpha), only use objectanimator how to do?The idea is not very good, may say use animatorset ah, this see is a bunch of animation plug together to execute, but I have to use a objectanimator in
(). getheight (); int windowwidth = Wm.getdefaultdisplay (). GetWidth (); 39//Calculate sample rate ScaleX int = imagewidth/windowwidth;41 int ScaleY = image height/windowheight;42 int Scale = 1;43//Sample rate according to the maximum direction of the IF (ScaleX > ScaleY scaleY >= 1) {45 Scale = scalex;46}47 if (ScaleX
($this->image_resource = = ") {return false;}It wasn ' t able to load the image}else{return false;}Something happened!if ($this->keep_proportions = = True){if ($img _width-$this->sizelimit_x) > ($img _height-$this->sizelimit_y)){If the width of the IMG is greater than the size limit we scale by width$scalex = ($this->sizelimit_x/$img _width);$scaley = $scalex;}ElseIf the height of the IMG is greater than t
(+); Alphaanimation.setrepeatcount (0); Alphaanimation.setrepeatmode (valueanimator.reverse); Alphaanimation.setstartdelay ($); Alphaanimation.setinterpolator (new acceleratedecelerateinterpolator ()); Alphaanimation.start ();For Java code implementations, Objectanimator provides the following methods: Offloat (), Ofint (), Ofobject (), Ofargb (), Ofpropertyvaluesholder () These are the elements that animate, the properties of the action, the start of an animation, the end, and
since we cannot add events directly to the display object we write, we can only QWidget determine whether the event is triggered by adding a mouse event and then making further calculations. For this we need to change the CanvasWidget class: class canvaswidget(qtgui.qwidget): def __init__(self):Super (Canvaswidget, self). __init__ () self.setmousetracking (True) def paintevent(self, event):Stage._onshow () def mousepressevent(self, event):Self.__entermouseevent (Event,"Mouse_down") def mous
= Item.offset (). Left + item.innerwidth ()/2-selecteddropdownwidth/2; Update dropdown and dropdown background position and size This.updatedropdown (Selecteddropdown, parseint (
Selecteddropdownheight), Selecteddropdownwidth, parseint (Selecteddropdownleft));
Add the. Active class to the selected dropdown and. Is-dropdown-visible to the. Cd-morph-dropdown//...}; MorphDropdown.prototype.updateDropdown = function (dropdownitem, height, width, left) {this.dropdownList.css ({'- Moz-transform ':
resolution of the picture from the options int imageheight = Opts.outheight; int imagewidth = Opts.outwidth;
Get the Android screen serviceWindowManager wm = (WindowManager) getsystemservice (Window_service);Get the resolution of the screen, GetHeight (), GetWidth has been discardedYou should use GetSize (), but you still use them for backward compatibility.int windowheight = Wm.getdefaultdisplay (). GetHeight ();int windowwidth = Wm.getdefaultdisplay (). GetWidth ();
Calculate sample
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.